﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DesktopModules_XsltDb_pu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BinaryReader br = new BinaryReader(Request.InputStream);
        byte[] bytes = br.ReadBytes(Request.ContentLength);

        Guid g = new Guid(Request["guid"]);
        long pos = long.Parse(Request["pos"] ?? "0");


        string dir = Server.MapPath("~/DesktopModules/XsltDb/tmp/");
        if (!Directory.Exists(dir))
            Directory.CreateDirectory(dir);

        string fn = dir + g.ToString() + ".bin";

        using (FileStream fs = File.OpenWrite(fn))
        {
            fs.Seek(pos, SeekOrigin.Begin);
            fs.Write(bytes, 0, bytes.Length);
        }
    }
}